<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>运行状态</title>
	<meta name="viewport"  content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" href="${path}/resource/plugins/bootstrap/css/bootstrap.min.css">
  	<link rel="stylesheet" type="text/css" href="${path}/resource/css/ysrmain.css">
	<link rel="stylesheet" href="${path}/resource/css/gzfx.css">
	
	<script src="${path}/resource/plugins/jQuery/jquery-2.2.3.min.js"></script>
	<script type="text/javascript" src="${path}/resource/plugins/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="${path}/resource/js/echarts.min.js"></script>

	<script type="text/javascript"></script>
	<style>
		.foot-div1{
			display:block;
		}
		.right-content{
			background: none;
		   	border:none;
		    box-shadow: none;
		}
		/*实时数据变化颜色*/
		.color-red{color:red}
		.color-yellow{color:yellow}
		.color-red2{animation:red 0.3s linear infinite alternate;border: 1px solid #3c763d;}
		.color-yellow2{animation:yellow 1s linear infinite alternate;border: 1px solid #3c763d;}
		.color-green2{background: #5be15b;border: 1px solid #3c763d;box-shadow: 0 0 10px 4px #9cf49c;}
		.color-red3{animation:red2 0.3s linear infinite alternate;}
		.color-yellow3{animation:yellow2 1s linear infinite alternate;}
		.color-green3{color:#5be15b}
		@keyframes red
			{
				from {box-shadow:0 0 10px #fff;background:rgba(255,0,0,1)}
				to {box-shadow:0 0 20px red;background:rgba(255,100,100,1)}
				
			}
		@keyframes yellow
			{
				from {box-shadow:0 0 5px #fff;background:rgba(255,255,0,1)}
				to {box-shadow:0 0 20px #fff;background:rgba(255,255,255,1)}
				
			}
		@keyframes red2
			{
				from {text-shadow:0 0 10px #fff;color:rgba(255,0,0,1)}
				to {text-shadow:0 0 20px red;color:rgba(255,100,100,1)}
				
			}
			
		@keyframes yellow2
			{
			from {text-shadow:0 0 5px #fff;color:rgba(255,255,0,1)}
			to {text-shadow:0 0 20px #fff;color:rgba(255,255,255,1)}
			
			}
		/*主图表的顶部图*/
		.top-img{height:35%;width:100%;overflow: hidden;}
			.left-img{width:80%;height:100%;float:left;padding:2% 2%;}
				.left-img>div{width:100%;height:100%;border-radius:5px;overflow: hidden;border: 1px solid #337ab7;box-shadow: 0px 0px 8px #3399b7;color: #fff;}
					.left-img>div>div{height:100%;width:33.33333%;float:left}
					.left-img>div>div>.foot-div1{margin:0}
			.right-img{width:20%;height:100%;float:right;padding:2% 2%;}
				.right-img>div{border: 1px solid #337ab7;box-shadow: 0px 0px 8px #3399b7;color: #fff;height:100%}
					
		.sssj-img-wapper{height:65%;width:100%;position:relative}
		/*身份信息*/
		.equip-msg{padding:;}
			.equip-msg>.equip-msg-bg{ height:100%;margin: 0;}
				.equip-msg>div>div{padding-top:0px}
				.equip-msg-bg>h3{margin:0;font-size:2rem;padding: 7px;}
				.equip-msg-bg>div>div{padding-top:4px; background: #337ab7; color: #fff;margin-top: 5px;padding: 2px 10px;}
		
		#locationMap{display:block}
		/*隐藏地图版权信息*/
		.anchorBL{display:none;}
		/*温度  */
		.flex-wendu{display: flex;flex-wrap: wrap;height: calc(100% - 25px);}
		.temperature{width:50%;display: flex;justify-content: space-around;align-items: center;}
		.temperature>small{vertical-align: super;}
		.foot-div1>div{display:block;font-size:1rem;text-align: initial;	}
			.foot-table{display:table;width:100%;height:calc(100% - 26px);font-size:1.4rem}
			.foot-table>div{display: table-cell;vertical-align: middle;text-align: center;}
		.foot-icon{display:table;}
		.foot-icon>div{display: table-cell;vertical-align: middle;text-align: center; font-size: 2em;}
		.border-right{}
		.progress { height: 15px;width: 30%;display: inline-block;margin: 0; background-color: rgba(51, 122, 183, 0.32);}
		/*弹窗  */
		.main-data {position:relative;}
		.layer{position:absolute;top:0;width:100%;height:100%;left:0;background:url(${path}/resource/images/layerbg2.png);background-size:100% 100%;z-index:100}
			.layer-bg{position:absolute;width:50%;height:60%;top:0;bottom:0;left:0;right:0;margin:auto;color:#fff;}				
		       .layer-head{border: 1px solid #337ab7;letter-spacing: 3px;color:#fff;height:50px;line-height:50px;font-size:2rem;padding:0 30px;border-top-right-radius: 5px;border-top-left-radius: 5px;}
			   		.layer-head::after{top:20px}
			   		.layer-head>a{cursor: pointer;height: 30px;display: inline-block;width: 40px;text-align: center;float: right;position: relative;right: -10px;top: 11px;line-height: 25px;font-size: 30px;}
			   		.layer-head>a:hover{color:#3399b7;}
			   .layer-body{border: 1px solid #337ab7;padding:10px;height:90%;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;color:#333;background: rgba(238, 238, 238, 0.3);}
					.layer-msg{width:50%;float:left;height:95%;border-right: 2px solid #3399b7;}
					.layer-analyse{width:50%;float:right;height:100%;}
				 		.analyse-img{margin:10px;height:50%;border-bottom:2px dotted #3399b7}
				 	    .analyse-span{margin:10px;height:40%;}
		/*底部第二个信息卡*/
		.co>div{background:url(${path}/resource/images/cojp.png);background-size:100% 100%;height: 8rem;width: 9rem;margin: auto;font-size: 1.2rem;}
		.hd>div{background:url(${path}/resource/images/hdjs.png);background-size:100% 100%;height: 8rem;width: 9rem;margin: auto;font-size: 1.2rem;}
		.rm>div{background:url(${path}/resource/images/rmjs.png);background-size:100% 100%;height: 8rem;width: 9rem;margin: auto;font-size: 1.2rem;}
		.co,.hd,.rm{ width: 33.3%}
		/*第三个信息卡*/
		.gzpd{display:table;height:calc(100% - 25px);width:100%;padding:0 10px;color:#ade8f9}
		.gzpd-img{display:table-cell;text-align:center;vertical-align: middle;}
			.gzpd-img>img{border-radius:50%;width:70px;height:70px}
		.gzpd-msg{display:table-cell;text-align:center;vertical-align: middle;width:80%;background:url(${path}/resource/images/gzpd.png);background-size:100% 100%;}
			.gzpd-msg>div{ width: 100%;height: 100%; padding: 1rem 30px;text-align:left;letter-spacing: 2px;flex-direction: column;align-items: flex-start;justify-content: space-between;display: flex;}
				.gzpd-msg>div>div{padding:2px;border-bottom:1px solid #31708f;width:100%}
		
	</style>
</head>
<body>
	<!-- 头部 -->
	<!-- 开始 -->
	<jsp:include page="top_nav.jsp"></jsp:include>
	<!-- 头部结束 -->
    
    <!-- 右侧内容区域 -->
    <div class="right-content container-fluid ">
    	<div class="row">
    		<!-- 主要图表区域 -->
	    	<div class="main-data col-xs-9">
	    		<!--头部nav-->
	    		<div class="row right-nav">
	    			<div class=" center" style="padding-right:40px">
	    				<a class="color-m1" href="${path}/manage/redirect/allEquip/allEquipList">
	    					<img src="${path}/resource/images/back3.png">
	    				</a>
	    			</div>
	    			<div class=" center nav-select">
	    				<a class="color-m2" href="${path}/manage/redirect/allEquip/nowEquip?serialNum=${serialNum}">
	    					<img src="${path}/resource/images/yxzt2.png" style="height:60px">
	    				运行状态
	    				</a>
	    			</div>
	    			<div class=" center nav-hover">
	    				<a class="color-m1" href="${path}/manage/redirect/allEquip/faultAnalysis?serialNum=${serialNum}">
	    				<img src="${path}/resource/images/gzfx3.png">
	    				故障分析
	    				</a>
	    			</div>
	    			<div class=" center nav-hover">
	    				<a class="color-m1" href="${path}/manage/redirect/allEquip/energyEfficiency?serialNum=${serialNum}">
	    				<img src="${path}/resource/images/nxgl3.png">
	    				能效分析
	    				</a>
	    			</div>
	    			<div class=" center nav-hover">
	    				<a class="color-m1" href="${path}/manage/redirect/allEquip/healthControl?serialNum=${serialNum}">
	    				<img src="${path}/resource/images/jkgl3.png">
	    				健康管理
	    				</a>
	    			</div>
	    			<div class=" center nav-hover">
	    				<a class="color-m1" href="${path}/manage/redirect/allEquip/historyEquip?serialNum=${serialNum}">
	    				<img src="${path}/resource/images/lssj3.png">
	    				历史数据
	    				</a>
	    			</div>
	    			
	    			<div class=" right nav-over padding-r-1">	    				
	    				<div class="color-w">当前设备:${serialNum}</div>
	    			</div>
	    			
	    		</div>
	    		<!-- 主图表 -->
	    		<div class="main-img">
	    			<div class="top-img">
	    				<div class="left-img">
	    					<div>
			    				<!--温度模块  -->
				    			<div class="  ">
					    			<div class=" " style="height:100%"> 
					    				<div class="point foot-name ">身份信息</div>
<!-- 					    				<div id="echarts2" style="width: 50%; height: 100%;float:left"></div> -->
<!-- 					    				<div id="echarts3" style="width: 50%; height: 100%;float:left"></div> -->
						    			<div class="flex-wendu">
							    			<div class="temperature">
						    					<small>进口温度</small>
						    					<div class="progress">
						    						<div id="m1w1" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span>0</span>&deg;C</small>									
											</div>
											<div class="temperature">
						    					<small>进口温度</small>
						    					<div class="progress">
						    						<div id="m2w1" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span>0</span>&deg;C</small>									
											</div>
											<div class="temperature">
						    					<small>整流温度</small>
						    					<div class="progress">
						    						<div id="m1w2" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span >0</span>&deg;C</small>									
											</div>
											<div class="temperature">
						    					<small>整流温度</small>
						    					<div class="progress">
						    						<div id="m2w2" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span>0</span>&deg;C</small>									
											</div>
											<div class="temperature">
						    					<small>逆变温度</small>
						    					<div class="progress">
						    						<div id="m1w3" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span>0</span>&deg;C</small>									
											</div>
											<div class="temperature">
						    					<small>逆变温度</small>
						    					<div class="progress">
						    						<div id="m2w3" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
												</div>
												<small><span>0</span>&deg;C</small>									
											</div>
										</div>
					    			</div>
					    		</div>
					    		
				    			<!--转速模块  -->
			    				<div class="  padding-l">
					    			<div class="  border-right" style="height:100%"> 
					    				<div class="point foot-name ">给定转速</div>
					    				<div id="echarts4" style="width: 100%; height:100% ;" style="height: calc(100% - 26px);"></div>
					    			</div>
					    		
				    			</div>
				    			<!--故障灯-->
				    			<div class="  led">
				    				<div class="point foot-name ">提示信息</div>
				    				<div class="led-list">
				    		
					    				<div class=" center ">
							    			<span id="fanstate" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>风机</span>
						    			</div>
						    			<div class=" center">
							    			<span id="breakerstate" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>断路器</span>
						    			</div>
						    			
						    			<div class=" center">
							    			<span id="faultlight" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>故障灯</span>
						    			</div>
						    			<div class=" center">
							    			<span id="runninglight" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>运行灯</span>
						    			</div>
						    			<div class="center">
							    			<span id="greestartingstate" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>格力启机</span>
						    			</div> 
						    			
						    			<div class=" center">
							    			<span id="startinverter" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>启逆变</span>
						    			</div>
						    			<div class=" center">
							    			<span id="startfourquadrant" class="glyphicon glyphicon-record color-green3"></span><br>
							    			<span>启四象限</span>
						    			</div>
					    			
					    			</div>
				    			</div>
			    			</div>
		    			</div>
		    			<!--天气  -->
		    			<div class="right-img">
		    				<div>
		    					<div class="point foot-name ">天气</div>
			    				<div class="weather-msg" style="padding:1px 10px;border-bottom:1px solid #3399b7">
			    					<div style="float:right;">
			    						<img style="width:60px"src="${path}/resource/images/weather.png">
			    					</div> 	
			    					<div>	    					
				    					<span id="weaaddress" class="wearaddress">株洲</span><br>
				    					<span class="wearwendu" style="font-size:40px"><span id="weawendu" >20</span>&deg;</span>
			    					</div>
			    									
			    					<!-- <span id="weatime" class="weartime">20</span> -->
			    					
			    				</div>
			    				<div style="clear:both;padding:5px 10px;">
			    					
			    					<div style="float:right;" id="weaqy">气压:1019hPa</div>
			    					<div id="weaSD">湿度:68%</div>
			    				</div>
		    				</div>
		    			</div>
	    			
	    			</div>
	    			
	    			
	    			<div class="sssj-img-wapper">
	    				<img src="${path}/resource/images/sssj2.png" class="sssj-img">
	    				<div class="nowbox1 color-w" style="cursor:pointer"><span>网压</span><br><span id='netvoltagespan'>0</span><span>V</span></div>
		    			<div class="nowbox2 color-w"><span>输入电流</span><br><span id="currentinputspan">0</span><span>A</span></div>
		    			<div class="nowbox3 color-red"><span>输入功率</span><br><span id="inputpowerspan">0</span><span>kW</span></div>
		    			<div class="nowbox4 color-red"><span>中间电流</span><br><span id="intermediatecurrentspan">0</span><span>A</span></div>	
		    			<div class="nowbox5 color-yellow"><span>中间电压</span><br><span id="intermediatevotspan">0</span><span>V</span></div>	    			
		    			<div class="nowbox6 color-yellow"><span>输出电流</span><br><span id="currentoutputspan">0</span><span>A</span></div>
		    			<div class="nowbox7 color-yellow"><span>实际频率</span><br><span id="actualfreqspan">0</span><span>Hz</span></div>	    			
	    				<span class="nowpoint1 color-green2"></span>
	    				<span class="nowpoint2 color-green2"></span>
	    				<span class="nowpoint3 color-red2"></span>
	    				<span class="nowpoint4 color-red2"></span>
	    				<span class="nowpoint5 color-yellow2"></span>
	    				<span class="nowpoint6 color-yellow2"></span> 
	    				<span class="nowpoint7 color-yellow2"></span>
	    			</div>
	    			
	    			
	    		</div>
	    		
	    	</div>
	    	
	    	<!-- 右侧列表 -->
	    	<div class=" col-xs-3 right-ul center">
	    		<div class="right-list">
	    			<div class="center">
			    		<div class="input-group search-input ">
					      <input id="require" type="text"  class="form-control float-r search back-m1 color-w">
					      <span class="input-group-btn">
					        <button class="btn btn-default search-btn" type="button" onclick="search();"></button>
					      </span>
						</div>
						<div class="left table-head color-w">
							<span >序列号</span><span class="float-r">运行状态</span>
						</div>
						<div class="ul-div">
	
							<table id="listtable" class="table table-striped color-w">
							  
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  <tr>
							  	<td class="left"><a class="color-w" href="<%=path%>/manage/redirect/allEquip/faultAnalysis?serialNum=0181413C">0181413C</a></td>
							  	<td class="right">正常</td>
							  </tr>
							  
							 
							</table>
						</div>
					</div>
	    		</div>
	    	</div>
	    	
	    	<!-- 底部表格 -->
	    	<div class="foot-img">
	    		<div class="col-xs-4 margin-t-1 ">
	    			<div class="foot-div1 back-a"> 
	    				<div class="point foot-name ">位置信息</div>
	    				<div id="locationMap" style="width: 100%; height: calc(100% - 26px);display:block"></div>
	    			</div>
	    		</div>
	    		<div class="col-xs-4 margin-t-1  padding-l  ">
	    			<div class="foot-div2 back-a">
	    				<div class="point foot-name ">能效分析</div>
	    				<div class="foot-table">
			    			<div class="co">
			    				<div>
			    					<span id="co2" class="color-w" style="padding-top:24px;display:inline-block">0</span><span class="color-w">千克</span>
			    				</div>																
							</div>
							<div class="hd">
								<div>
									<span id="electric" class="color-w" style="padding-top:24px;display:inline-block">0</span><span class="color-w">度</span>
								</div>					
							</div>
							<div class="rm">
								<div>
									<span id="coal" class="color-w" style="padding-top:24px;display:inline-block">0</span><span class="color-w">吨</span>
								</div>													
							</div>
						</div>
					</div>
	    		</div>
	    		<div class="col-xs-4 margin-t-1 ">
	    			<div class="foot-div3 back-a  "> 
	    				<div class="point foot-name ">身份信息</div>
	    				<!-- <div class="equip-msg-bg">
		    				<div class="col-xs-12">
		    					<div>
		    						<span class="float-r" id="powerLevelType">TPower-IC1</span>
		    						<span>型号:</span>
		    					</div>
		    					<div >
		    						<span class="float-r" id="operationDate">2016-07-07 15:02:38</span>
		    						<span>出厂时间:</span>
		    					</div>
		    					<div >
		    						<span class="float-r" id="softwareVersion">1.01</span>
		    						<span>软件版本:</span>
		    					</div>
		    					<div >
		    						<span class="float-r" id="softwareVersion">完成</span>
		    						<span>出厂调试:</span>
		    					</div>
	
		    				</div>
	    				</div> -->
	    				<div class="gzpd">
		    				<div class="gzpd-img"><img src="${path}/resource/images/gzsbbg.png"></div>
		    				<div class="gzpd-msg">
								<div class=''>
									
									<div>
			    						<span>额&nbsp;定&nbsp;功&nbsp;率:</span>&nbsp;&nbsp;<span id="ratedInputPower">1000</span><span>kW</span>
			    					</div>
			    					<div>							    					
			    						<span>额&nbsp;定&nbsp;电&nbsp;压:</span>&nbsp;&nbsp;<span id="ratedInputVoltage">1000</span><span>V</span>
			    					</div>
			    					<div>
			    						<span>额&nbsp;定&nbsp;电&nbsp;流:</span>&nbsp;&nbsp;<span id="ratedInputCurrent">10000</span><span>A</span>
			    					</div>
			    					<div>
			    						<span>出&nbsp;厂&nbsp;时&nbsp;间:</span>&nbsp;&nbsp;<span id="operationDate">2011-12-12</span>
			    					</div>		    				
		    					</div>
		    				</div> 
	    				</div>
	    			</div>
	    		</div>
	    	</div>
    	</div>
    	
    </div>
	

	<!--弹窗-->
	<div class="layer" style="display: none;">
		<div class="layer-bg">
			<div class="layer-head point foot-name">
				<span>网压体征分析:</span>
				<a class="off-layer">x</a>
			</div>
			<div  class="layer-body">
				
     			 <div id="echarts1" style="width:100%;height:100%;"></div>
     
  
   
			</div>
		</div>
	</div>

	
</body>
<script type="text/javascript" src="${path}/resource/js/webSocketConf.js"></script>	
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM"></script>
<script type="text/javascript">
/*弹窗JS*/

      var myChart1;

      function randomData() {
        now = new Date(+now + oneDay);
        value = Math.random() * 1000 - 10;
        return {
          name: [now.getHours(), now.getMinutes(), now.getSeconds()].join(':'),//now.toString(),
          value: Math.round(value)/*[
            //[now.getHours(), now.getMinutes(), now.getSeconds()].join(':'),
            Math.round(value)
          ]*/
        }
      }

      var data = [];
      var xAxisData = [];
      var now = new Date();//new Date(1997, 9, 3);
      var oneDay = 10 * 1000;
      var value = Math.random() * 1000;
//       for(var i = 0; i < 10; i++) {
//         var allData = randomData();
//         data.push(allData.value);
//         xAxisData.push(allData.name);
//       }
      var option = {
        tooltip: {
          trigger: 'axis',
          triggerOn: 'click',//[ default: 'mousemove' ]
          axisPointer: {
//            animation: false
            lineStyle: {
              opacity: 0
            }
          },
          formatter: function (params,ticket,callback) {
            var $pna = params[0].name;
            var res = '<div style="width:600px;background:#337ab7;border:1px solid #20FCFF;border-radius:5px;padding:10px"><span style="color:#20FCFF;">智能分析:</span><br><span style="color:#fff">设备正常</span></div>';
            
//            setTimeout(function (){
//              // 仅为了模拟异步回调
//              callback(ticket, res);//回调函数，这里可以做异步请求加载的一些代码
//            }, 1000);
            return res;
          },
          position: function (point, params, dom) {
            // 固定在顶部
            return ['10%', 0];
          },
          backgroundColor:'none',
          confine: true //是否将 tooltip 框限制在图表的区域内。
        },
        grid: {
          show: false,
          top: '30%',
          bottom: '15%'
        },
        xAxis: {
          type: 'category',
          name: '时间',
          nameTextStyle: {
            color: '#20FCFF'
          },
          axisLine: {//轴线
            lineStyle: {
              color: '#20FCFF'
            }
          },
          axisTick: {//刻度
            show: false
          },
          axisLabel: {//刻度标签
            textStyle: {
              color: '#fff'
            }
          },
          splitLine: {
            show: true,
            lineStyle: {
            	color: 'rgba(255,255,255,0.1)'
            }
          },
          boundaryGap: false,
          data: xAxisData
        },
        yAxis: {
          type: 'value',
          name: '网压(V)',
          nameTextStyle: {
            color: '#20FCFF'
          },
          axisLine: {//轴线
            lineStyle: {
              color: '#20FCFF'
            }
          },
          axisTick: {//刻度
            show: false
          },
          axisLabel: {//刻度标签
            textStyle: {
              color: '#fff'
            }
          },
          splitLine: {
            show: true,
            lineStyle: {
            	color: 'rgba(255,255,255,0.1)'
            }
          },
        },
        series: [{
          name: '模拟数据',
          type: 'line',
          lineStyle: {
            normal: {
              color: '#20FCFF'
            }
          },
          itemStyle: {
            normal: {
              color: '#20FCFF'
            },
            emphasis: {
              color: 'red'
            }
          },
//          hoverAnimation: false,
          data: data
        }]
      };
      
//       setInterval(function() {
// //        for(var i = 0; i < 5; i++) {
//           data.shift();
//           xAxisData.shift();
//           var allData = randomData();
//           data.push(allData.value);
//           xAxisData.push(allData.name);
// //        }
//         myChart1.setOption({
//           xAxis: {
//             data: xAxisData
//           },
//           series: [{
//             data: data
//           }]
//         });
//       }, 10000);
 
/*弹窗*/
$(function(){
	$(".nowbox1").click(function(){
		$(".layer").show();
		if(myChart1 == null || myChart1 == undefined) {
			myChart1 = echarts.init(document.getElementById("echarts1"));
			myChart1.setOption(option);
		}
	})
	$(".off-layer").click(function(){
		$(".layer").hide();
	})
})

$(function(){
	$(".img-qbsb").parent().css({"color":"#82d1e8","text-shadow":" 0px 0px 10px #b7d6df"});
	$(".img-qbsb").parent().parent().addClass("dl-active");
	$(".img-qbsb").attr("src","${path}/resource/images/qbsb2.png"); 
	$.ajax({
		type : 'POST',
		url : '<%=path%>/manage/secondliveData',
		data : {
			serialNum : '${serialNum}'
		},
		dataType : 'json',
		async : false,
		success : function(result) {
			console.log(result);
			if(result.status == 'OK') {
				var devInfo = eval("(" + result.data.devInfo + ")")[0];
				$('#powerLevelType').text(devInfo.powerLevelType);
				$('#operationDate').text(devInfo.operationDate);
				$('#softwareVersion').text(devInfo.softwareVersion);
				$('#productGroup').text(devInfo.productGroup);
				$('#changecontactor').text(devInfo.changecontactor);
				$('#dccircuitbreakernum').text(devInfo.dccircuitbreaker);
				$('#fanstart').text(devInfo.fanstart);
				$('#reactortcswitch').text(devInfo.reactortcswitch);
				
				$('#ratedInputPower').text(devInfo.ratedInputPower);
				$('#ratedInputVoltage').text(devInfo.ratedInputVoltage);
				$('#ratedInputCurrent').text(devInfo.ratedInputCurrent);
			} else {
				//alert("系统错误！");
			}
		},
		error : function() {
			//alert("系统错误！");
		}
	})
	firstinit();
	initLocationMap();
	initContribution();
	initWeather();
	//test环境
// 	search();
// 	initecharts();
})	

	//加载地图
	function initLocationMap() {
		$.ajax({
			url : '<%=path%>/manage/secondhistDataLocation',
			data : { serialNum : '${serialNum}' },
	        type : 'post',
	        dataType : 'json',
	        async : false,	        
	        success : function(result) {
	        	var geoCoord = eval("(" + result.data.geoCoord + ")");
	    		//initmap(geoCoord[0], geoCoord[1]);
	    		// 百度地图API功能
	    		map = new BMap.Map("locationMap", {enableMapClick:false}); //构造底图时，关闭底图可点功能
	    		map.setMapType(BMAP_NORMAL_MAP); //设置默认为卫星图
	    		var point = new BMap.Point(geoCoord[0], geoCoord[1]);
	    		map.centerAndZoom(point, 13);
	    		//map.setMinZoom(8);
	    		map.disableDragging(); //禁止拖拽
	    		map.disableScrollWheelZoom(); //禁用滚轮缩放
	    		//map.enableDragging(); //开启拖拽
	    		//map.enableScrollWheelZoom(); //允许滚轮缩放
	    		var marker = new BMap.Marker(point);
	    		map.addOverlay(marker);
			},			
			error : function(result) {
				console.error('error');
			}
		});	
	}
	
	//能效分析
// 	var contribution = echarts.init(document.getElementById("contribution"));
// 	contribution.setOption({
// 		title: { text: '能效分析', },
// 	    tooltip: {
// 	        trigger: 'axis',
// 	        axisPointer: { type: 'shadow' }
// 	    },
// 	    grid : {
// 	    	top : '20%',
// 	    	bottom : '20%',
// 	    	left : '25%'
// 	    },
// 	    xAxis: {
// 	        type: 'value',
// 	        boundaryGap: [0, 0.01]
// 	    },
// 	    yAxis: {
// 	        type: 'category',
// 	        axisLabel : {
// 	        	textStyle : { fontSize : 10 }
// 	        },
// 	        data: ['co2减排（千克）','耗电节省（度）','燃煤节省（吨）']
// 	    },
// 	    series: [{
// 	    	type:'bar',
// 	    	data:[33,75,150],
// 	    }]
// 	});
	function initContribution(){
		<%-- $.ajax({
			url : '<%=path%>/manage/secondhistDataContribution',
			data : { serialNum : '${serialNum}' },
	        type : 'post',
	        dataType : 'json',
	        async : false,	        
	        success : function(result) {
	        	var electric = result.data.electSave.toString();
				if(electric.indexOf(".") > 0) {
					electric = electric.substring(0,7);
				} else {
					electric = electric.substring(0,6);
				}
				var co2 = result.data.coSave.toString();
				if(co2.indexOf(".") > 0) {
					co2 = co2.substring(0,7);
				} else {
					co2 = co2.substring(0,6);
				}
				var coal = result.data.coalSave.toString();
				if(coal.indexOf(".") > 0) {
					coal = coal.substring(0,7);
				} else {
					coal = coal.substring(0,6);
				}
				
				contribution.setOption({
					series: [{
				    	data:[co2, electric, coal],
				    }]
				});
			},			
			error : function(result) {
				console.error('error');
			}
		});	 --%>
		$.ajax({
			url : '<%=path%>/manage/secondhistDataContribution',
			data : { serialNum : '${serialNum}' },
	        type : 'post',
	        dataType : 'json',
	        async : false,	        
	        success : function(result) {
	        	var electric = result.data.electSave.toString();
				if(electric.indexOf(".") > 0) {
					electric = electric.substring(0,7);
				} else {
					electric = electric.substring(0,6);
				}
				$('#electric').text(electric);
				var co2 = result.data.coSave.toString();
				if(co2.indexOf(".") > 0) {
					co2 = co2.substring(0,7);
				} else {
					co2 = co2.substring(0,6);
				}
				$('#co2').text(co2);
				var coal = result.data.coalSave.toString();
				if(coal.indexOf(".") > 0) {
					coal = coal.substring(0,7);
				} else {
					coal = coal.substring(0,6);
				}
				$('#coal').text(coal);
			},			
			error : function(result) {
				console.error('error');
			}
		});	
	}
	//加载天气
	function initWeather() {
		$.ajax({
			type : 'POST',
			url : '<%=path%>/manage/secondweatherData',
			data : { serialNum : '${serialNum}' },
			dataType : 'json',
			async : false,
			success : function(result) {
				if(result.status == "OK") {
					console.log(result.data);
					$('#weaaddress').text(result.data.city);
					$('#weatime').text((result.data.time).substring(0,10));
					$('#weawendu').text(result.data.temp);
					$('#weaSD').text("湿度:" + result.data.SD);
					$('#weaqy').text("气压:" + result.data.qy + "hPa");
				}
			},
			error : function() {
				//alert("系统错误！");
			}
		})
	}
	
	//加载右侧列表
	function search() {
		$.ajax({
			type : 'POST',
			url : '<%=path%>/manage/seconddevTotal',
			data : {
				livedata : livedata,
				require : $("#require").val()
			},
			dataType : 'json',
			async : false,
			success : function(result) {
				if(result.status == "OK") {
					$('#listtable').text('');
					//var html = "<tr><th>变频器序列号</th><th>安装位置</th><th>投运时间</th><th>工作状态</th></tr>";
					var html = "";
					$.each(result.data, function(i){
						var href = "<%=path%>/manage/redirect/allEquip/nowEquip?serialNum="+result.data[i].serialNum;
						html += '<tr><td class="left"><a href='+href+'>'+result.data[i].serialNum +
								'</a></td><td class="right">'+result.data[i].state +'</td></tr>';
					});
					$('#listtable').append(html);
				}
			},
			error : function() {
				//alert("系统错误！");
			}
		})
	}
// var myEcharts2;
// var myEcharts3;
var myEcharts4;
function firstinit() {
// 	myEcharts2 = echarts.init(document.getElementById("echarts2"));
// 	myEcharts3 = echarts.init(document.getElementById("echarts3"));
	myEcharts4 = echarts.init(document.getElementById("echarts4"));
	initecharts();
}
function initecharts() {
// 	myEcharts2.setOption({
// 		title: {
// 			x:'right',
// 			y:'bottom',
// 	        text: '模块一',
// 	    },
// 	    legend: {
// 	        orient: 'vertical',
// 	        x: 'right',
// 	        data:['进口温度','整流温度','逆变温度']
// 	    },
// 	    series: [
// 	             {
// 	                 name:'1',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['70%', '90%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果 
// 	                 label: {
// 	                	 normal: {
// 	                         show: true,
// 	                         position: 'inner',
// 	                         formatter : '{c}'
// 	                     },
// 	                     emphasis: {  
// 	                    	 show: true,
// 	                         textStyle: {
// 	                             fontSize: '8',
// 	                             fontWeight: 'bold'
// 	                         }
// 	                     }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m1w1,
// 	     				name : '进口温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
// 	             {
// 	                 name:'2',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['50%', '70%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果 
// 	                 label: {normal: {
//                          show: true,
//                          position: 'inner',
//                          formatter : '{c}'
//                      },
//                      emphasis: {  
//                     	 show: true,
//                          textStyle: {
//                              fontSize: '8',
//                              fontWeight: 'bold'
//                          }
//                      }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m1w2,
// 	     				name : '整流温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
// 	             {
// 	                 name:'3',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['30%', '50%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果
// 	                 label: {normal: {
//                          show: true,
//                          position: 'inner',
//                          formatter : '{c}'
//                      },
//                      emphasis: {  
//                     	 show: true,
//                          textStyle: {
//                              fontSize: '8',
//                              fontWeight: 'bold'
//                          }
//                      }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m1w3,
// 	     				name : '逆变温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
	             
// 	         ]
		
// 	});


// 	myEcharts3.setOption({
// 		title: {
// 			x:'right',
// 			y:'bottom',
// 	        text: '模块二(双模块机组)',
// 	    },
// 	    legend: {
// 	        orient: 'vertical',
// 	        x: 'right',
// 	        data:['进口温度','整流温度','逆变温度']
// 	    },
// 	    series: [
// 	             {
// 	                 name:'1',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['70%', '90%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果 
// 	                 label: {normal: {
// 	                         show: true,
// 	                         position: 'inner',
// 	                         formatter : '{c}'
// 	                     },
// 	                     emphasis: {  
// 	                    	 show: true,
// 	                         textStyle: {
// 	                             fontSize: '8',
// 	                             fontWeight: 'bold'
// 	                         }
// 	                     }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m2w1,
// 	     				name : '进口温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
// 	             {
// 	                 name:'2',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['50%', '70%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果 
// 	                 label: {normal: {
//                          show: true,
//                          position: 'inner',
//                          formatter : '{c}'
//                      },
//                      emphasis: {  
//                     	 show: true,
//                          textStyle: {
//                              fontSize: '8',
//                              fontWeight: 'bold'
//                          }
//                      }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m2w2,
// 	     				name : '整流温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
// 	             {
// 	                 name:'3',
// 	                 type:'pie',
// 	                 clockWise : false,
// 	                 radius: ['30%', '50%'],   //内环半径，外环半径
// 	                 hoverAnimation:false,    //扇形放大效果
// 	                 label: {normal: {
//                          show: true,
//                          position: 'inner',
//                          formatter : '{c}'
//                      },
//                      emphasis: {  
//                     	 show: true,
//                          textStyle: {
//                              fontSize: '8',
//                              fontWeight: 'bold'
//                          }
//                      }
// 	                 },
// 	                 labelLine: { normal: {
// 	                         show: false
// 	                     }
// 	                 },
// 	                 data : [ {
// 	     				value : m2w3,
// 	     				name : '逆变温度'
// 	     			}, {
// 	     				value : 200,
// 	     				name : 'invisible',
// 	     				itemStyle : {
// 	     					normal:{opacity:0},
// 	     					emphasis:{opacity:0},
// 	     				},
// 	     				label : {
// 	     					normal : {
// 	     						show : false
// 	     					}
// 	     				}
// 	     			} ]
	                
// 	             },
	             
// 	         ]
	   
// 	});

	
	myEcharts4.setOption({
		    series: [
		        {
		            name: '给定转速',
		            type: 'gauge',
		            radius: '80%',//表盘半径
		            startAngle: 180,//仪表盘起始角度。圆心 正右手侧为0度，正上方为90度，正左手侧为180度。
		            endAngle: 0,
		            min: 0,
		            max: 20000,
		            splitNumber: 5,//仪表盘刻度的分割段数。
		            axisLine: { //刻度线
		            	show: true,
		            	lineStyle: {
			            	color: [[theoreticspeed/20000, '#c23531'], [1, '#337ab7']],
			            		//仪表盘的轴线可以被分成不同颜色的多段。每段的结束位置和颜色可以通过一个数组来表示。
			            		//默认取值：[[0.2, '#91c7ae'], [0.8, '#63869e'], [1, '#c23531']]
			            	width: 10,
			            	//shadowBlur: ...,
			            	//shadowColor: ...,
			            	//shadowOffsetX: 0,
			            	//shadowOffsetY: 0,
			            	//opacity: ...,
		            	}
		            },
		            splitLine: { //分隔线
		            	show: true,
		            	length: 11,
		            	lineStyle: {
			            	color: '#eee',
			            	width: 2,
			            	type: 'solid',
			            	//shadowBlur: ...,
			            	//shadowColor: ...,
			            	//shadowOffsetX: 0,
			            	//shadowOffsetY: 0,
			            	//opacity: ...,
		            	}
		            },
				    axisTick:{ //小刻度
				    	show: false
				    },
		            axisLabel : { //刻度值
				    	formatter : function (v){
				    		switch(v) {
				    		case 0 : return '0';
				    		case 8000 : return '8000';
				    		case 20000 : return '20000';
				    		}
				    	}
				    },
		            pointer: { //指针
		            	show: true,
		            	length: '100%',
		            	width: 3,
		            },
				    itemStyle : { //指针样式
				    	normal : {
				    		color: '#ff0000'
				    	}
				    },
		            title :{
		            	show: false,
		            	offsetCenter :[0,'-20%'],
		            },
		            detail: {
		            	formatter:'{value} r/min',
		            	textStyle : {
		            		fontSize: '20',
		            		color : '#fff'
		            	}},
		            data: [{value: theoreticspeed, name: 'r/min'}]
		        }
		    ]
	});
}
	var theoreticspeed = 0;
	
	var netvoltagespan,currentinputspan,inputpowerspan;
	var intermediatevotspan,intermediatecurrentspan,currentoutputspan;
	var actualfreqspan;
	
	var m1w1=0,m1w2=0,m1w3=0;
	var m2w1=0,m2w2=0,m2w3=0;
	
	var secondsnum = 0;
//获取指定设备实时数据
	
	jQuery.browser={};
    (function(){
    	jQuery.browser.msie=false; 
    	jQuery.browser.version=0;
    	if(navigator.userAgent.match(/MSIE ([0-9]+)./)){ 
    		jQuery.browser.msie=true;
    		jQuery.browser.version=RegExp.$1;
    	}
    })();
	var webSocket = null;
	if ("WebSocket" in window) {
		webSocket = new WebSocket(webSocketUrl);
		console.log("建立实时连接！");
	} else if ("MozWebSocket" in window) {
		webSocket = new MozWebSocket(webSocketUrl);
		console.log("建立实时连接！");
	} else {
		alert("浏览器不支持！");
	};
	webSocket.onerror = function() {
		alert("无法建立实时连接！");
	};
	webSocket.onopen = function(event) {
		//setInterval('send()',1000);
		send();
		console.log("open");
	};
	webSocket.onmessage = function() {
		var map=eval(JSON.parse(event.data.toString()));
		for ( var dev in map) {			
			for ( var key in map[dev]) {
				//staupdate(key,map[dev][key]);
				//console.log(key+" : "+map[dev][key]);
				led(key,map[dev][key]);
			}	
// 			if(secondsnum%10 == 0) {
				console.log("网压:"+ map[dev]["c86"]);
				if(data.length >= 10) {
					data.shift();
					xAxisData.shift();
				}
				now = new Date(+new Date() + oneDay);
				var xAxisTime = [now.getHours(), now.getMinutes(), now.getSeconds()].join(':');
				
				if($.inArray(xAxisTime, xAxisData) == -1) {
					xAxisData.push(xAxisTime);
					var netvoltage = map[dev]["c86"];
					data.push(netvoltage);
				
					if(myChart1 != null && myChart1 != undefined) {
						myChart1.setOption({
							xAxis: {
								data: xAxisData
							},
							series: [{
								data: data
							}]
						});
					}
				}
// 			}
			secondsnum++;
			
// 			theoreticspeed = map[dev]["theoreticspeed"] == undefined || map[dev]["theoreticspeed"] == "undefined" ? 0 : map[dev]["theoreticspeed"];
// 			$('#netvoltagespan').text(map[dev]["netvoltage"]);
// 			$('#currentinputspan').text(map[dev]["currentinput"]);
// 			$('#inputpowerspan').text(map[dev]["inputpower"]);
// 			$('#intermediatevotspan').text(map[dev]["intermediatevot"]);
// 			$('#intermediatecurrentspan').text(map[dev]["intermediatecurrent"]);
// 			$('#currentoutputspan').text(map[dev]["currentoutput"]);
// 			$('#actualfreqspan').text(map[dev]["actualfreq"]);
			
// 			m1w1 = map[dev]["module1temperature1"] == undefined || map[dev]["module1temperature1"] == "undefined" ? 0 : map[dev]["module1temperature1"];
// 			m1w2 = map[dev]["module1temperature2"] == undefined || map[dev]["module1temperature2"] == "undefined" ? 0 : map[dev]["module1temperature2"];
// 			m1w3 = map[dev]["module1temperature3"] == undefined || map[dev]["module1temperature3"] == "undefined" ? 0 : map[dev]["module1temperature3"];
// 			m2w1 = map[dev]["module2temperature1"] == undefined || map[dev]["module2temperature1"] == "undefined" ? 0 : map[dev]["module2temperature1"];
// 			m2w2 = map[dev]["module2temperature2"] == undefined || map[dev]["module2temperature2"] == "undefined" ? 0 : map[dev]["module2temperature2"];
// 			m2w3 = map[dev]["module2temperature3"] == undefined || map[dev]["module2temperature3"] == "undefined" ? 0 : map[dev]["module2temperature3"];

			theoreticspeed = map[dev]["c82"] == undefined || map[dev]["c82"] == "undefined" ? 0 : map[dev]["c82"];
			$('#netvoltagespan').text(map[dev]["c86"]);
			$('#currentinputspan').text(map[dev]["c85"]);
			$('#inputpowerspan').text(map[dev]["c217"]);
			$('#intermediatevotspan').text(map[dev]["c87"]);
			$('#intermediatecurrentspan').text(map[dev]["c218"]);
			$('#currentoutputspan').text(map[dev]["c84"]);
			$('#actualfreqspan').text(map[dev]["c83"]);
			m1w1 = map[dev]["c79"] == undefined || map[dev]["c79"] == "undefined" ? 0 : map[dev]["c79"];
			m1w2 = map[dev]["c80"] == undefined || map[dev]["c80"] == "undefined" ? 0 : map[dev]["c80"];
			m1w3 = map[dev]["c81"] == undefined || map[dev]["c81"] == "undefined" ? 0 : map[dev]["c81"];
			m2w1 = map[dev]["c188"] == undefined || map[dev]["c188"] == "undefined" ? 0 : map[dev]["c188"];
			m2w2 = map[dev]["c189"] == undefined || map[dev]["c189"] == "undefined" ? 0 : map[dev]["c189"];
			m2w3 = map[dev]["c190"] == undefined || map[dev]["c190"] == "undefined" ? 0 : map[dev]["c190"];

			//console.log(m1w1);console.log(m1w2);console.log(m1w3);
			$('#m1w1').css("width", m1w1+'%'); $('#m1w1').parent('div').next('small').children('span').text(m1w1); 
			$('#m1w2').css("width", m1w2+'%'); $('#m1w2').parent('div').next('small').children('span').text(m1w2); 
			$('#m1w3').css("width", m1w3+'%'); $('#m1w3').parent('div').next('small').children('span').text(m1w3); 
			$('#m2w1').css("width", m2w1+'%'); $('#m2w1').parent('div').next('small').children('span').text(m2w1); 
			$('#m2w2').css("width", m2w2+'%'); $('#m2w2').parent('div').next('small').children('span').text(m2w2); 
			$('#m2w3').css("width", m2w3+'%'); $('#m2w3').parent('div').next('small').children('span').text(m2w3); 	
			
			initecharts();
		}		
	};
	function send(){    //Websocket接口
		var message = "[{\"serialnum\":\"${serialNum}\",\"signalnames\":[\"all\"]}]";//调用参数
		//console.log(message);
		webSocket.send(message);
	};
// 	window.onload = function(){
// 		checkcount();
// 	};
	window.onbeforeunload = function (e) { 
		e = e || window.event; 
		if (e) { 
			webSocket.close();
		} 
	}; 
	
	function led(key,value){
		var ledspan = $('.led span');
		for(var i=0; i<ledspan.length; i++){
			if(key == ledspan[i].id){
				if(value) {
					$("#"+ledspan[i].id).removeClass("color-red3");
					if(key == "faultlight") {
						$("#"+ledspan[i].id).addClass("color-green3");
					} else {
						$("#"+ledspan[i].id).addClass("color-green3");
					}
				} else {
					$("#"+ledspan[i].id).removeClass("color-green3");
					//$("#"+ledspan[i].id).removeClass("color-g");
					$("#"+ledspan[i].id).addClass("color-red3");
				}
			}
		}
	}
	
//获取设备列表实时数据
	
	var webSocket2 = null;
    var livedata;
    if ("WebSocket" in window) {
		webSocket2 = new WebSocket(webSocketUrl);
		console.log("建立实时连接！");
	} else if ("MozWebSocket" in window) {
		webSocket2 = new MozWebSocket(webSocketUrl);
		console.log("建立实时连接！");
	} else {
		alert("浏览器不支持！");
	}
	webSocket2.onerror = function() {
		alert("无法建立实时连接！");
	};
	webSocket2.onopen = function(event) {
		send2();
		console.log("open");
	};
	webSocket2.onmessage = function() {
		if(event.data.length>2){
			livedata=event.data;
			//tableinitinfo();
			search();
			webSocket2.close();
		}else{
			console.log("resend...");
			send2();
		}		
	};
	webSocket2.onclose = function() {
	};
	window.onbeforeunload = function() {
		webSocket2.close();
	};
	function send2(){    //Websocket接口
	    console.log("send");
// 	    var message = "[{\"serialnum\":\"all\",\"signalnames\":[\"breakerstate\",\"runninglight\",\"faultlight\"]}]";//调用参数
		var message = "[{\"serialnum\":\"all\",\"signalnames\":[\"c196\",\"c78\",\"c77\"]}]";//调用参数
	    webSocket2.send(message);
	}
</script>
</html>